package org.bizming.medicine.service;

import java.util.List;

import org.bizming.base.BaseErrCode;
import org.bizming.base.BaseException;
import org.bizming.medicine.dao.MedicineStatusDao;
import org.bizming.medicine.model.help.ActionType;
import org.bizming.medicine.model.help.MedicineStatus;

public class MedicineStatusServiceImpl implements MedicineStatusService {

	private MedicineStatusDao statusDao;

	@Override
	public boolean add(MedicineStatus t) throws BaseException {
		if (!t.isValidate(ActionType.ADD)) {
			throw new BaseException(BaseErrCode.INVALIDATE);
		}
		return statusDao.add(t);
	}

	@Override
	public boolean update(MedicineStatus t) throws BaseException {
		if (!t.isValidate(ActionType.UPDATE)) {
			throw new BaseException(BaseErrCode.INVALIDATE);
		}
		return statusDao.update(t);
	}

	@Override
	public MedicineStatus get(int id) {
		return statusDao.get(id);
	}

	@Override
	public boolean remove(int id) {
		return statusDao.remove(id);
	}

	@Override
	public List<MedicineStatus> selectList() {
		return statusDao.selectList();
	}

	public MedicineStatusDao getStatusDao() {
		return statusDao;
	}

	public void setStatusDao(MedicineStatusDao statusDao) {
		this.statusDao = statusDao;
	}

}
